A Tour of some of Dart 3’s Impactful New Features

I created a public Gist of my experience touring Dart 3’s new features via their Dart Codelab.

  • Gist files from Dart’s codelab: Dive into Dart 3’s new OO language enhancements including patterns, records, enhanced switch and case, and sealed classes.

It was intriguing and educational!! 💡

A couple of the features I recall learning or using from either previous JavaScript enhancements, 
or definitely from when I worked with React (e.g. destructuring ‘records’). Still others were quite new, with one or two that definitely took some time to sink in (e.g. object-destructuring a Duration object with guards).

When learning of Dart 3 records — which help to pass type-safe maps (of a sort) without the need to create a class for them — I couldn’t help but think of a Flutter Bloc analogy, “cubits for classes“.
All-in-all it was a fun and eye-opening experience, and I highly recommend taking the time to go through it. Many of the features will likely prove confusing should you begin happening across them in the wild.

The following course overview and links are also provided in the [main.dart] gist file.
flutter create –empty patterns_codelab
  • “In this course you will experiment with patterns, records, enhanced switch and case, and sealed classes. You will cover a lot of information — yet only barely scratch the surface of these features.”
  • “Dart 3 introduces patterns to the language, a major new category of grammar. Beyond this new way to write Dart code, there are several other language enhancements, including:”
    • Records for bundling data of different types,
    • class modifiers for controlling access, and
    • new switch expressions and if-case statements.
  • For more information on patterns, see the feature specification.
  • For even more specific information, see the individual feature specifications:

Keith D Commiskey
https://keithdc.com

Leave a Reply